package com.mcglib.flac
{
	import flash.events.IEventDispatcher;
	
	public class Collection extends FlacComponent
	{
		protected var _dataProvide:*;
		
		protected var _selectable:Boolean;
		
		protected var _selectItem:*;
		
		protected var _dataRendererClass:Class;
		
		protected var _selectedRenderer:IDataRenderer;
		
		public function Collection(target:IEventDispatcher=null)
		{
			super(target);
		}
		
		public function get selectedRenderer():IDataRenderer
		{
			return _selectedRenderer;
		}

		public function get dataRendererClass():Class
		{
			return _dataRendererClass;
		}

		public function set dataRendererClass(value:Class):void
		{
			_dataRendererClass = value;
		}

		public function get selectable():Boolean
		{
			return _selectable;
		}
		
		public function set selectable(value:Boolean):void
		{
			_selectable = value;
		}
		
		public function get selectItem():*
		{
			return _selectItem;
		}
		
		public function set selectItem(item:*):void{
			if(_selectItem==item)
				return;
			
			if(_selectedRenderer){
				_selectedRenderer.selected = false;
				_selectedRenderer = null;
			}
			for each(var render:ProxyRender in proxyRenderDic.values()){
				if(render.data == item){
					
					_selectProxyRender = render;
					_selectProxyRender.select = true;
					break;
				}
			}	
			
			_selectItem = item;
			dispatchSelectEvent();
			
		}
		
		public function refresh():void{
				
		}
	}
}